﻿using MvcFrameStruct.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace MvcFrameStruct.Extends
{
    public class ArticleExtend
    {
        TestEntities testentities = new TestEntities();
        
        public List<Models.Article> GetArticle(string title, int PageSize, int CurrentCount, out int TotalCount)
        {
            var query = testentities.Article.Where(o => o.Title.Contains(title));
            TotalCount = query.Count();
            return query.OrderBy(o => o.PubDate).Skip(CurrentCount).Take(PageSize).ToList();
        }
    }
}